<#include "../common/_layout.html"/> <@layout>
<link href="/select2/select2.css" rel="stylesheet" type="text/css" />
<link href="/css/select2-bootstrap.css" rel="stylesheet" type="text/css" />

<div class="panel panel-default">
	<div class="panel-heading">
		<h3 class="panel-title">创建Team</h3>
	</div>
	<div class="panel-body">
		<div class="form-group">
			<label for="name">名称（a-zA-Z0-9_-）：</label> <input type="text"
				id="name" class="form-control" />
		</div>
		<div class="form-group">
			<label for="resume">简介（方便以后能想起这个组的作用，选填）：</label> <input
				type="text" id="resume" class="form-control" />
		</div>
		<div class="form-group">
			<label for="users">成员：</label> <input
				type="text" id="users" class="form-control" />
		</div>
		<button type="button" class="btn btn-primary"
			onclick="create_team();">创建</button>
		<a href="javascript:window.history.go(-1);" class="btn btn-default">取消</a>
	</div>
</div>

<script src="/select2/select2.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
	$("#users").select2({
        placeholder: "输入要添加组员的name",
        allowClear: true,
        multiple: true,
        quietMillis: 100,
        minimumInputLength: 2,
        id: function(obj){return obj.id;},
        ajax: {
            url: "/user/query",
            dataType: 'json',
            data: function(term, page) {
                return {
                    query: term,
                    limit: 20
                };
            },
            results: function(json, page) {
                return {results: json.users};
            }
        },
        formatResult: function(obj) {return obj.name + "["+obj.cnname+"]" + "["+obj.email+"]"},
        formatSelection: function(obj) {return obj.name},
    });
});
</script>

</@layout>
